<template>
  <div class="connector-card-container">
    
    <ConnectorModuleConnectorCard
      :main-module-value="mainModuleValue"
      :card="card"
      :bizId="bizId"
      :visible="visible"
      :fromBizNo="fromBizNo"
      :showCreateButton="showCreateButton"
      :showEditButton="showEditButton"
      :showDeleteButton="showDeleteButton"
      :showExportButton="showExportButton"
    />
    
  </div>
</template>

<script>
/* components */
import { ConnectorModuleConnectorCard } from '@src/modules/connector/components'
/* mixin */
import cardMixin from './mixin'

export default {
  name: 'connector-card-warper',
  mixins: [cardMixin],
  props: {
    bizId: {
      type: String,
      default: ''
    },
    mainModuleValue: {
      type: Object,
      default: () => ({})
    },
    card: {
      type: Object,
      default: () => ({})
    },
    task: {
      type: Object,
      default: () => ({})
    },
    visible: {
      type: Boolean,
      default: false
    },
    customer: {
      type: Object,
      default: () => ({})
    },
    product: {
      type: Object,
      default: () => ({})
    },
    isDelete: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    // 是否不为已删除的客户，已删除的客户不能操作数据
    isNotDelete() {
      return !this.isDelete
    },
    // 是否显示新建按钮
    showCreateButton() {
      return this.isNotDelete && this.allowCreate
    },
    // 是否显示编辑按钮
    showEditButton() {
      return this.isNotDelete && this.allowEdit
    },
    // 是否显示删除按钮
    showDeleteButton() {
      return this.isNotDelete && this.allowDelete
    },
    // 是否显示导出按钮
    showExportButton() {
      return this.isNotDelete && this.isExport
    },
    fromBizNo() {
      return this.customer?.serialNumber || this.product?.name || ''
    }
  },
  components: {
    ConnectorModuleConnectorCard
  }
}
</script>
<style lang="scss"> 

</style>